<%@ page import="java.util.List" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>主界面</title>
    <style>
        #head_ {
            height: 100px;
            width: 100%;
            background-color: slategray;
        }

        #personFile {
            width: 180px;
            height: 50px;
            padding-top: 25px;
            margin-left: 90%;
        }

        #search {
            height: 70px;
            width: 100%;
            background-color: cornflowerblue;
        }

        #inner_s {
            /*width: 200px;
            height: 40px;
            padding-right: 70%;
            padding-top: 50%;*/
            width: 30%;
            padding-top: 25px;
            padding-left: 45%;
        }

        #table {
            margin-left: 30%;
            margin-top: 30px;
        }

        td {
            text-align: center;
            height: 20px;
            width: 150px;
            border: black 1px solid;
            padding: 1px;
        }
        #insert{
            font-size: 15px;
            width: 60px;
            height: 30px;
            align-content: center;
            background-color: lightseagreen;
            border-radius: 5px;
            border:1px solid black;
        }
    </style>
</head>
<body>

<div id="head_">
    <div id="personFile">
        名字:<span style="color: red">&nbsp; ${requestScope.u.get(0).u_name} 你好！</span><br>
        编号:<span style="color: red">&nbsp; ${requestScope.u.get(0).u_id}</span>
    </div>
</div>

<div id="search">
    <div id="inner_s">
        <input type="text" style="font-size: 20px; height: 26px;width: 190px" id="date" name="date">&nbsp;&nbsp;
        <button style="font-size: 18px; height: 28px;" id="select" onclick="select()">查询</button>
            <a href="insert.jsp"><button id="insert">+增加</button></a>
    </div>
</div>
<script>
    function select(){
        let v=document.getElementById("date").value;
        window.location.href = "mainSelect?id=" + ${requestScope.u.get(0).u_id}+"&date="+v;
    }
</script>
<div>
    <table id="table" style="height: 30px;width: 700px;border: black 1px solid;border-collapse:collapse;">
        <tr>
            <th>序号</th>
            <th>姓名</th>
            <th>性别</th>
            <th>成绩</th>
            <th>操作</th>
        </tr>
        <c:forEach items="${requestScope.user}" var="users">
            <tr>
                <td>${users.u_id}</td>
                <td>${users.u_name}</td>
                <td>${users.u_sex}</td>
                <td>
                    <button onclick="GoShow(${users.u_id})" style="color: red">查看</button>
                </td>
                <td>
                    <button onclick="Godelete(${users.u_id})" style="color: red">删除学生</button>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>
<script>
    <%--
         点击查看按钮 把对应学生的id发送给后台进行查询成绩
         后台把全部科目成绩返回到前台进行可视化
       --%>

    function GoShow(u_id) {
        //u_id为当前点击按钮对应的序号 将u_id发送给服务器
        window.location.href = "show?u_id=" + u_id + "&id=" + ${requestScope.u.get(0).u_id};
    }

    <%--    点击删除按扭 把数据删除 把状态为改变--%>

    function Godelete(v) {
        let t = confirm("是否删除" + v + "这位同学");
        if (t) {
            window.location.href = "del?v=" + v + "&id=" + ${requestScope.u.get(0).u_id};
        }
    }
</script>
<div>
</div>
</body>
</html>

